<!--{__NOLAYOUT__}-->
<html><head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width">
    <title>签订《提分宝典》服务保障合同</title>
    <meta name="Keywords" content="">
    <meta name="Description" content="">
    <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="https://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/css/queren.css" />
    <link rel="stylesheet" href="https://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/css/generate.css" />
    <script type="text/javascript" src="https://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/js/layer_mobile/layer.js"></script>
    <link rel="stylesheet" type="text/css" href="https://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/css/layer.css" />
    <script src="https://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/js/jquery.1.9.1.js"></script>
    <script type="text/javascript" src="https://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/js/rem.js"></script>
    <script type="text/javascript" src="https://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/js/address_select/mobileSelect.js"></script>
    <link rel="stylesheet" type="text/css" href="https://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/js/address_select/mobileSelect.css" />
</head>
<body class="body_tj">
<div id="tbh5v0">
    <div class="addressmone">
	    	<div class="example">
	    		信息填写完成后视为合同签定<a href="{$urlpdf}">点击查看合同范本</a>
	    	</div>
	    	<div style="width: 100%;height: 0.2rem;background-color: #f5f5f5;"></div>
        <ul>
            <li>
                <span>学生姓名 <i>*</i></span>
                <em>
                		<input type="text" name="student_name" value="{$row.student_name??''}" id="student_name" >
                		<img src="https://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/images/student_03.png"/>
                </em>
            </li>
            <li>
                <span>学生性别<i>*</i></span>
                <em>
	                	<input type="radio" name="gender" id="gender1" value="1" checked />
	                	<label for="gender1"><span>男</span></label>
	                	<input type="radio" name="gender" id="gender2" value="2" />
	                	<label for="gender2"><span>女</span></label>
                </em>
            </li>
            <li>
                <span>身份证号<i>*</i></span>
                <em>
                		<input type="text" name="id_card" value="{$row.id_card??''}" id="id_card" >
                		<img src="https://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/images/student_07.png"/>
                </em>
            </li> 
           
            <li>
                <span>家长姓名<i>*</i></span><em><input type="text" name="parent_name" value="{$row.parent_name??''}" id="parent_name" ></em>
            </li> 
            <li>
                <span>手机号码 <i>*</i></span>
                <em>
                		<input style="width: 98%;height: 0.7rem;" type="number" pattern="[0-9]*" name="" id="phone" value="{$row.phone??''}" />
                		<img src="https://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/images/student_11.png"/>
                </em>
            </li>
            <li style="position: relative;">
                <span>验证码 <i>*</i></span>
                <em>
                		<input style="width: 60%;height: 0.7rem;" type="number" name="" id="yzm" pattern="[0-9]*" value="" oninput="if(value.length>4) value = value.slice(0,4)"/>
                		<img src="https://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/images/student_14.png"/>
                    <div class="huoqu">获取验证码</div>
                </em>
            </li>

            <li>
                <span>固定电话</span>
                <em>
                		<input style="width: 98%;height: 0.7rem;" type="number" pattern="[0-9]*" name="" id="tel" value="{$row.tel??''}" />
                		<img src="https://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/images/student_17.png"/>
                </em>
            </li>
             <li>
                <span>学生所在学校班级 <i>*</i></span><em><input type="text" name="grade" value="{$row.grade??''}" id="grade" ></em>
            </li>
        		<li style="margin-bottom: 0;">
                <span>所在地区联络地址<i>*</i></span>
                <div id="trigger4" class="trigger4" style="text-indent:0.5em;display: inline-block;border: 1px solid #ccc;width: 97%;height: 35px;line-height: 35px;font-size: 12px;border-radius: 5px;">
                    <span style="font-size: 12px;color: #666;">{$row.address_text??'请选择省市区县'}</span>
                </div>
                <input type="hidden" name="" id="province" value="{$row.province??''}" />
                <input type="hidden" name="" id="city" value="{$row.city??''}" />
                <input type="hidden" name="" id="area" value="{$row.area??''}" />
            </li>
            <li>
                <span>详细地址</span><em> <textarea name="address" id="address_">{$row.address??''}</textarea></em>

            </li>
            <li>
                <span>最近一次考试成绩 <i>*</i></span>
                <em><input style="width: 98%;height: 0.7rem;text-indent: 0.2rem;" type="number" pattern="[0-9]*" name="" id="last_exam" value="{$row.last_exam??''}" placeholder="请输入" /></em>
            </li>
             
           <!--<li>
                <span>版本</span>
                <em>
                    <select id="edition" value="">
                        <option value="0">请选择</option>
                        <option value="1">文科</option>
                        <option value="2">理科</option>
                        <option value="3">新高考</option>
                    </select>
                </em>
           </li>-->
             <li>
                <span>E-mail</span>
                <em>
                		<input type="text" name="email" value="{$row.email??''}" id="email" >
                		<img src="https://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/images/student_20.png"/>
                </em>
            </li>  
            <li>
                <span>邮政编码</span><em><input type="text" name="code" maxlength="6" value="{$row.code??''}" id="code" pattern="[0-9]*" ></em>
            </li>   
           
            
        </ul>
		<div style="padding: 0.3rem;background-color: #f5f5f5;font-size: 0.3rem;line-height: 0.35rem;">本电子版合同与纸质合同具有同等法律效力，请签定完成后保存，纸质版合同原件随产品寄达。</div>
        <!--<div class="dotm_btn">-->
            <input type="submit" value="提交信息并签字" class="dotm_btn1">
        <!--</div>-->

    </div>
</div>

<script>
  $(function(){
    var arrarea = [];
  var province = "{$row.province??1}";
  var city = "{$row.city??2}";
  var area = "{$row.area??3}";  
  var province_more = '';
  var city_more = '';
  var area_more = '';
   $.ajax({
      type: "post",
      url: "/api/ajax/area",
      dataType: "json",
         async: false,
      success: function(res){
         arrarea = res.data;
         console.log(arrarea);
      }
  });
  for (var i = 0; i < arrarea.length; i++) { 
    if(province == arrarea[i]['id']){
      province_more = i;
        for (var s = 0; s < arrarea[i]['childs'].length; s++) {
          if(city == arrarea[i]['childs'][s]['id']){
            city_more = s;
            for (var a = 0; a < arrarea[i]['childs'][s]['childs'].length; a++) {
                if(area == arrarea[i]['childs'][s]['childs'][a]['id']){

                  area_more = a;
                }
              }
          }
        }
    }
   }
   console.log(province_more);
   console.log(city_more);
  var mobileSelect4 = new MobileSelect({
      trigger: '#trigger4',
      title: '地区选择',
      wheels: [{data:arrarea}],
      position:[province_more,city_more,area_more],
     callback:function(indexArr, data){
        $('#province').val(data[0].id);
        $('#city').val(data[1].id);
        $('#area').val(data[2].id);
        $('.addr').css('font-size','0.2rem');
     }  
  });
    $('.huoqu').click(function() {
      var tel = $('#phone').val();
      if(!(/^1[3456789]\d{9}$/.test(tel))) {
        layer.open({
          content: '请输入正确的手机号码',
          skin: 'msg',
          time: 2 //2秒后自动关闭
        });
        return false;
      }

      $.ajax({
        type: 'post',
        url:"/api/sms/send" ,
        data:{mobile:tel,event:'contract'},
        success: function(data){
          console.log(data);
          if(data.code != 1){
            layer.open({
              content:data.msg ,
              skin: 'msg',
              time: 2 //2秒后自动关闭
            });
            return false
          }else{
            var count = 120;
            const countDown = setInterval(() => {
              if (count === 0) {
                $('.huoqu').text('重新发送').removeAttr('disabled');
                $('.huoqu').css({
                  background: '#f3494c',
                  color: '#fff',
                });
                clearInterval(countDown);
              } else {
                $('.huoqu').attr('disabled', true);
                $('.huoqu').css({
                  background: '#eee',
                  color: '#333',
                });
                $('.huoqu').text(count + '秒后可重新获取');
              }
              count--;
            }, 1000);
          }
        }
      });
    });

    $('.dotm_btn1').click(function(){
      var student_name = $('#student_name').val();
      var parent_name = $('#parent_name').val();
      var gender = $('input[name="gender"]:checked').val();
      var id_card = $('#id_card').val();
      var grade = $('#grade').val();
      var last_exam = $('#last_exam').val();
      var address = $('#address_').val();
      var phone = $('#phone').val();
      var tel = $('#tel').val();
      var code = $('#code').val();
      var province = $('#province').val();
      var city = $('#city').val();
      var area = $('#area').val();
      // var edition = $('#edition').val();
      var email = $('#email').val();
      var yzm = $('#yzm').val();
      if(student_name == ""||student_name == null){
        layer.open({
          content: '请填写学生姓名',
          skin: 'msg',
          time: 2 //2秒后自动关闭
        });
         $("#student_name").focus();
        return false;
      }
      if(gender == 0){
        layer.open({
          content: '请选择性别',
          skin: 'msg',
          time: 2 //2秒后自动关闭
        });
         $("#gender").focus();
        return false;
       }
       if (id_card.length != 18 || !(/^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/.test(id_card))) {
           layer.open({
              content: '您输入的身份证号码不是有效格式',
              skin: 'msg',
              time: 2 //2秒后自动关闭
            });
          $("#id_card").focus();
            return false;

       }
    // if(edition == 0){
    //     layer.open({
    //       content: '请选择版本',
    //       skin: 'msg',
    //       time: 2 //2秒后自动关闭
    //     });
    //       $("#edition").focus();
    //     return false;
    //   }
   if(parent_name == ""||parent_name == null){
        layer.open({
          content: '请填写家长姓名',
          skin: 'msg',
          time: 2 //2秒后自动关闭
        });
         $("#parent_name").focus();
        return false;
      }
      if(!(/^1[3456789]\d{9}$/.test(phone))) {
        layer.open({
          content: '请输入正确的手机号码',
          skin: 'msg',
          time: 2 //2秒后自动关闭
        });
           $("#phone").focus();
        return false;
      }

      if(yzm == ""||yzm == null){
        layer.open({
          content: '请填写验证码',
          skin: 'msg',
          time: 2 //2秒后自动关闭
        });
          $("#yzm").focus();
        return false;
      }
      if(grade == ""||grade == null){
        layer.open({
          content: '请填写学生所在学校班级',
          skin: 'msg',
          time: 2 //2秒后自动关闭
        });
        $("#grade").focus();
        return false;
      }   
     
      
      if(province == ""||province == null){
        layer.open({
          content: '请选择所在地区',
          skin: 'msg',
          time: 2 //2秒后自动关闭
        });
        return false;
      }
      // if(address == ""||address == null){
      //   layer.open({
      //     content: '请填写详细地址',
      //     skin: 'msg',
      //     time: 2 //2秒后自动关闭
      //   });
      //   return false;
      // }
     if(last_exam == ""||last_exam == null){
        layer.open({
          content: '请填写最后一次考试成绩',
          skin: 'msg',
          time: 2 //2秒后自动关闭
        });
        $("#last_exam").focus();
        return false;
      }
      if(email == ""||email == null){
        // layer.open({
        //   content: '请填写邮箱',
        //   skin: 'msg',
        //   time: 2 //2秒后自动关闭
        // });
        // $("#email").focus();
        // return false;
      }else{
      var myreg = /^([\.a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/;
          if(!myreg.test(email)){
              layer.open({
                content: '邮箱格式不正确，请重新填写',
                skin: 'msg',
                time: 2 //2秒后自动关闭
              });
              return false;
          }
      }
        var index = layer.open({type: 2});
      //验证验证码
      $.ajax({
        type: 'post',
        url:"/api/sms/check" ,
        data:{mobile:phone,captcha:yzm,event:'contract'},
        success: function(data){
          if(data.code == 0){
            layer.close(index);
            layer.open({
              content: data.msg,
              skin: 'msg',
              time: 2,
            });
            return false;
          }else{
            //添加禁止标签
            $('.dotm_btn1').attr("disabled","disabled");
            $.ajax({
              type: 'post',
              url:"/index/pdf/generate2/type/{$type}/userid/{$userid}/order_id/{$order_id}/product_id/{$product_id}/key/{$keyyy}" ,
              data:{student_name:student_name,id_card:id_card,gender:gender,grade:grade,last_exam:last_exam,parent_name:parent_name,phone:phone,tel:tel,code:code,email:email,address:address,province:province,city:city,area:area},
              success: function(data){
                layer.close(index);
                 layer.open({
                    content: data.msg,
                    skin: 'msg',
                    time: 2, //2秒后自动关闭
                  });
                if(data.code == 0){
                  $('.dotm_btn1').attr("disabled","");
                  return false;
                }else{
                 window.location.href="/index/pdf/handwriting2/ids/"+data.data; 
                }
                

              }
            });
          }
        }
      });


    });
  });




</script>
</body>

</html>